package com.syxp.pda.service.detail.impl;

import java.util.List;

import com.syxp.pda.core.bean.FieldBean;
import com.syxp.pda.core.command.QueryFilter;
import com.syxp.pda.core.util.Operation;
import com.syxp.pda.dao.base.DeviceBaseInfoDao;
import com.syxp.pda.dao.detail.CheckPlanDetailDao;
import com.syxp.pda.dao.standard.DeviceCheckStandardDao;
import com.syxp.pda.entity.base.DeviceBaseInfo;
import com.syxp.pda.entity.standard.DeviceCheckStandard;
import com.syxp.pda.service.detail.ResultTrendService;

public class ResultTrendServiceImpl implements ResultTrendService {

	private DeviceBaseInfoDao deviceBaseInfoDao;

	private DeviceCheckStandardDao deviceCheckStandardDao;

	private CheckPlanDetailDao checkPlanDetailDao;

	public CheckPlanDetailDao getCheckPlanDetailDao() {
		return checkPlanDetailDao;
	}

	public void setCheckPlanDetailDao(CheckPlanDetailDao checkPlanDetailDao) {
		this.checkPlanDetailDao = checkPlanDetailDao;
	}

	public DeviceCheckStandardDao getDeviceCheckStandardDao() {
		return deviceCheckStandardDao;
	}

	public void setDeviceCheckStandardDao(
			DeviceCheckStandardDao deviceCheckStandardDao) {
		this.deviceCheckStandardDao = deviceCheckStandardDao;
	}

	public DeviceBaseInfoDao getDeviceBaseInfoDao() {
		return deviceBaseInfoDao;
	}

	public void setDeviceBaseInfoDao(DeviceBaseInfoDao deviceBaseInfoDao) {
		this.deviceBaseInfoDao = deviceBaseInfoDao;
	}

	@Override
	public List<DeviceBaseInfo> loadZoneDevice(int zoneID) {
		QueryFilter qf = new QueryFilter();
		qf.addFilter(new FieldBean("zoneID", zoneID, Operation.EQUAL));
		List<DeviceBaseInfo> zones = deviceBaseInfoDao.getAll(qf);
		return zones;
	}

	@Override
	public List<DeviceCheckStandard> loadDeviceAnswer(int deivceID) {
		return deviceCheckStandardDao.getByDeviceID(deivceID);
	}

	@Override
	public List<Object[]> resultTrend(int checkStandardID, String startDate,
			String endDate, String precision) {
		return checkPlanDetailDao.getReusltTrend(checkStandardID, startDate,
				endDate, precision);
	}
}
